package com.spring.controller.javastack.bean;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;

/**
 * Created by chenhs on 2018/6/14.
 *
 ===Constructor===
 ===@PostConstruct===
 === InitializingBean afterPropertiesSet ===
 ===initMethod===
 ===@PreDestroy===
 === DisposableBean destroy ===
 ===destroyMethod===
 *
 */
public class TestOrder {

    @Bean(initMethod = "initMethod", destroyMethod = "destroyMethod")
    public UserService getUserService() {
        return new UserService();
    }

    public static void main(String[] args) {
        AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
        ctx.register(TestOrder.class);
        ctx.refresh();
        ctx.registerShutdownHook();
    }


}
